Implement player exit: invalidate session, shred cards, advance initiative#105
Open
turkosaurus with Copilot wants to merge 4 commits into
Open
Implement player exit: invalidate session, shred cards, advance initiative#105turkosaurus with Copilot wants to merge 4 commits into
turkosaurus with Copilot wants to merge 4 commits into
Conversation
Copilot
AI
changed the title
[WIP] Fix exiting game functionality for cookies and cards
Implement player exit: invalidate session, shred cards, advance initiative
Jun 14, 2026
turkosaurus
marked this pull request as ready for review
June 14, 2026 01:47
…iting-game-is-noop # Conflicts: # rulette_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exiting a game was a no-op — clicking "exit" just navigated home without touching server state, leaving the player's session key live, their cards in play, and their initiative slot active.
Changes
New SQL query
GameCardsShredByPlayer— bulk-shreds all cards held by a player in a gameExit action handler (
actions.go)exitcase handled before the game-state switch so it works in any statestateTurn/statePending), resetsstatePending→stateTurnif needed, then callsadvanceTurnbefore deletion (soInitiativeAdvancestill sees the correct max initiative)game_players— their slot becomes a gap the existingadvanceTurngap-handler already toleratesMaxAge: -1,HttpOnly: true) and responds withHX-Redirect: /Footer template (
tmpl.footer.html)<a href="/">tohx-post="/{game_id}/action/exit"so the server-side cleanup runs before the redirectSecurity / correctness
math.MaxInt32bounds check on the player ID parsed from the cookie before casting toint32